package org.javaexpert.concurrent;

import java.util.List;
import java.util.ArrayList;

/**
 * Created by IntelliJ IDEA.
 * User: piotrga
 * Date: Dec 19, 2007
 * Time: 8:48:41 PM
 * To change this template use File | Settings | File Templates.
 */
public class Container {
    List content = new ArrayList();
    public synchronized void put(int index, Object what){
        content.add(index, what);
    }

    public synchronized void await(){
        try {
            this.wait();
        } catch (InterruptedException e) {
            new RuntimeException(e);
        }
    }

    public synchronized void wakeUp(){
        this.notifyAll();
    }

    public Object get(int i) {
        return content.get(i);
    }
}
